﻿using System.Data.Entity.ModelConfiguration;

namespace InvestmentIntelligence.DbModel.Models.Mapping
{
    internal class InvestmentBenchmarkSerieMap : EntityTypeConfiguration<InvestmentBenchmarkSerie>
    {
        public InvestmentBenchmarkSerieMap()
        {
            // Primary Key
            this.HasKey(t => new {t.InvestmentId, t.Date, t.SecurityId});

            // Table & Column Mappings
            this.ToTable("InvestmentBenchmarkSerie", "Analytics");
            this.Property(t => t.InvestmentId).HasColumnName("InvestmentId");
            this.Property(t => t.SecurityId).HasColumnName("SecurityId");
            this.Property(t => t.BenchmarkId).HasColumnName("BenchmarkId");
            this.Property(t => t.Date).HasColumnName("Date");
            this.Property(t => t.RoC).HasColumnName("RoC").HasPrecision(29, 20);
            this.Property(t => t.PositionPnL).HasColumnName("PositionPnL");
            this.Property(t => t.PositionFxPnL).HasColumnName("PositionFxPnL");
        }
    }
}
